home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hardcore Visual Basic 5.0 (2nd Edition)
/
Hardcore Visual Basic 5.0 - Second Edition (1997)(Microsoft Press).iso
/
Code
/
TIcon.Frm
< prev
next >
Wrap
Text File
|
1997-06-14
|
15KB
|
492 lines
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "COMCTL32.OCX"
Object = "*\APictureGlass.vbp"
Begin VB.Form FTestIcons
Caption = "Test Icons"
ClientHeight = 6135
ClientLeft = 1740
ClientTop = 1590
ClientWidth = 4620
Icon = "TIcon.frx":0000
LinkTopic = "Form1"
MousePointer = 99 'Custom
PaletteMode = 1 'UseZOrder
ScaleHeight = 6135
ScaleWidth = 4620
Begin VB.CheckBox chkSmall
BackColor = &H00FFFFFF&
Caption = "Small"
Height = 330
Left = 930
MaskColor = &H00FFFFFF&
Picture = "TIcon.frx":0442
TabIndex = 19
Top = 4770
Width = 780
End
Begin PictureGlass.XPictureGlass pg
Height = 375
Left = 480
TabIndex = 18
Top = 120
Width = 375
_ExtentX = 661
_ExtentY = 661
BackColor = -2147483628
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ScaleWidth = 375
ScaleMode = 0
ScaleHeight = 375
End
Begin VB.PictureBox pb
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H8000000A&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 540
Index = 0
Left = 2892
ScaleHeight = 540
ScaleWidth = 1275
TabIndex = 16
Top = 516
Width = 1275
End
Begin VB.PictureBox pb
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H8000000A&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 540
Index = 2
Left = 2892
ScaleHeight = 540
ScaleWidth = 1275
TabIndex = 11
Top = 1830
Width = 1275
End
Begin VB.PictureBox pb
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H8000000A&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 540
Index = 5
Left = 2892
ScaleHeight = 540
ScaleWidth = 1275
TabIndex = 3
Top = 3810
Width = 1275
End
Begin VB.PictureBox pb
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H8000000A&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 540
Index = 4
Left = 2892
ScaleHeight = 540
ScaleWidth = 1275
TabIndex = 2
Top = 3150
Width = 1275
End
Begin VB.PictureBox pb
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H8000000A&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 540
Index = 3
Left = 2892
ScaleHeight = 540
ScaleWidth = 1275
TabIndex = 1
Top = 2490
Width = 1275
End
Begin VB.PictureBox pb
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H8000000A&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 540
Index = 1
Left = 2892
ScaleHeight = 540
ScaleWidth = 1275
TabIndex = 0
Top = 1170
Width = 1275
End
Begin ComctlLib.ListView lstvwVB
Height = 810
Left = 135
TabIndex = 4
Top = 5175
Width = 1185
_ExtentX = 2090
_ExtentY = 1429
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 327680
ForeColor = -2147483640
BackColor = -2147483643
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MouseIcon = "TIcon.frx":2D24
NumItems = 0
End
Begin ComctlLib.ListView lstvwFixed
Height = 810
Left = 1440
TabIndex = 15
Top = 5190
Width = 1245
_ExtentX = 2196
_ExtentY = 1429
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 327680
ForeColor = -2147483640
BackColor = -2147483643
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MouseIcon = "TIcon.frx":2D40
NumItems = 0
End
Begin VB.Label lbl
BackStyle = 0 'Transparent
Caption = "ListView"
Height = 255
Index = 5
Left = 135
TabIndex = 20
Top = 4815
Width = 810
End
Begin VB.Image img
Appearance = 0 'Flat
Height = 540
Index = 0
Left = 1284
Top = 516
Width = 1272
End
Begin VB.Label lbl
BackStyle = 0 'Transparent
Caption = "Basic:"
Height = 432
Index = 7
Left = 324
TabIndex = 17
Top = 516
Width = 852
End
Begin ComctlLib.ImageList imlstSmallFixed
Left = 2040
Top = 6924
_ExtentX = 794
_ExtentY = 794
BackColor = -2147483643
_Version = 327680
End
Begin ComctlLib.ImageList imlstLargeFixed
Left = 1404
Top = 6924
_ExtentX = 794
_ExtentY = 794
BackColor = -2147483643
_Version = 327680
End
Begin VB.Label lblData
BackStyle = 0 'Transparent
Height = 855
Left = 2880
TabIndex = 14
Top = 5145
Width = 1770
End
Begin VB.Label lbl
BackStyle = 0 'Transparent
Caption = "Picture data:"
Height = 330
Index = 6
Left = 2880
TabIndex = 13
Top = 4815
Width = 1035
End
Begin VB.Image imgPattern
Height = 1920
Left = 3165
Picture = "TIcon.frx":2D5C
Top = 6795
Width = 1920
End
Begin VB.Image img
Appearance = 0 'Flat
Height = 540
Index = 2
Left = 1275
Top = 1830
Width = 1275
End
Begin VB.Label lbl
BackStyle = 0 'Transparent
Caption = "Shell Size:"
Height = 432
Index = 4
Left = 300
TabIndex = 12
Top = 1830
Width = 852
End
Begin VB.Label lbl
BackStyle = 0 'Transparent
Caption = "Image Size:"
Height = 432
Index = 3
Left = 300
TabIndex = 10
Top = 2490
Width = 876
End
Begin VB.Label lbl
BackStyle = 0 'Transparent
Caption = "Small:"
Height = 432
Index = 2
Left = 300
TabIndex = 9
Top = 3150
Width = 852
End
Begin VB.Label lbl
BackStyle = 0 'Transparent
Caption = "Huge:"
Height = 432
Index = 1
Left = 300
TabIndex = 8
Top = 3810
Width = 756
End
Begin VB.Label lbl
BackStyle = 0 'Transparent
Caption = "Default:"
Height = 432
Index = 0
Left = 336
TabIndex = 7
Top = 1170
Width = 852
End
Begin VB.Label lbl
BackStyle = 0 'Transparent
Caption = "Picture Boxes"
Height = 330
Index = 9
Left = 2880
TabIndex = 6
Top = 84
Width = 1275
End
Begin VB.Label lbl
BackStyle = 0 'Transparent
Caption = "Images"
Height = 336
Index = 8
Left = 1260
TabIndex = 5
Top = 84
Width = 1272
End
Begin ComctlLib.ImageList imlstLargeVB
Left = 96
Top = 6924
_ExtentX = 794
_ExtentY = 794
BackColor = -2147483643
_Version = 327680
End
Begin ComctlLib.ImageList imlstSmallVB
Left = 744
Top = 6924
_ExtentX = 794
_ExtentY = 794
BackColor = -2147483643
_Version = 327680
End
Begin VB.Image img
Appearance = 0 'Flat
Height = 540
Index = 5
Left = 1275
Top = 3810
Width = 1275
End
Begin VB.Image img
Appearance = 0 'Flat
Height = 540
Index = 1
Left = 1275
Top = 1170
Width = 1275
End
Begin VB.Image img
Appearance = 0 'Flat
Height = 540
Index = 3
Left = 1275
Top = 2490
Width = 1275
End
Begin VB.Image img
Appearance = 0 'Flat
Height = 540
Index = 4
Left = 1275
Top = 3150
Width = 1275
End
End
Attribute VB_Name = "FTestIcons"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private ctlLast As Control
Private ctlCur As Control
Enum EIconPos
eipBasic = 0
eipDefault
eipShell
eipImage
eipSmall
eipHuge
End Enum
Private Sub Form_Load()
If Not HasShell Then
MsgBox "This program requires the enhanced Windows user interface"
End
End If
' Load icon with Basic's LoadPicture (system metrics size)
Set img(eipBasic).Picture = LoadPicture("i.ico")
Set pb(eipBasic).Picture = LoadPicture("i.ico")
' Load icon with Basic's LoadPicture (system metrics size)
Set img(eipDefault).Picture = LoadAnyPicture("i.ico", eisDefault)
Set pb(eipDefault).Picture = LoadAnyPicture("i.ico", eisDefault)
' Load icon stretched to system metrics size
Set img(eipShell).Picture = LoadAnyPicture("i.ico", eisShell)
Set pb(eipShell).Picture = LoadAnyPicture("i.ico", eisShell)
' Load first icon image in file with its real size
Set img(eipImage).Picture = LoadAnyPicture("i.ico", eisImage)
Set pb(eipImage).Picture = LoadAnyPicture("i.ico", eisImage)
' Load small (16 by 16) icon, squashing if necessary
Set img(eipSmall).Picture = LoadAnyPicture("i.ico", eisSmall)
Set pb(eipSmall).Picture = LoadAnyPicture("i.ico", eisSmall)
' Load huge (48 by 48) icon
Set img(eipHuge).Picture = LoadAnyPicture("i.ico", eisHuge)
Set pb(eipHuge).Picture = LoadAnyPicture("i.ico", eisHuge)
Set ctlLast = pb(eipBasic)
Set ctlCur = img(eipBasic)
PictureData
' Load small and large ImageLists and put in ListView
imlstSmallVB.ListImages.Add , , LoadPicture("i.ico")
imlstLargeVB.ListImages.Add , , LoadPicture("i.ico")
Set lstvwVB.SmallIcons = imlstSmallVB
Set lstvwVB.Icons = imlstLargeVB
lstvwVB.ListItems.Add , , "Basic", 1, 1
imlstSmallFixed.ListImages.Add , , LoadAnyPicture("i.ico", eisSmall)
imlstLargeFixed.ListImages.Add , , LoadAnyPicture("i.ico", eisShell)
Set lstvwFixed.SmallIcons = imlstSmallFixed
Set lstvwFixed.Icons = imlstLargeFixed
lstvwFixed.ListItems.Add , , "Fixed", 1, 1
chkSmall_Click
chkSmall_Click
End Sub
Private Sub Form_Paint()
bmpTile Me, imgPattern.Picture
End Sub
Sub PictureData()
With ctlCur
Dim s As String
ctlLast.BorderStyle = 0
ctlCur.BorderStyle = 1
s = s & "Picture Width: " & Int(ScaleX(.Picture.Width, 8, vbPixels)) & sCrLf
s = s & "Picture Height: " & Int(ScaleY(.Picture.Height, 8, vbPixels)) & sCrLf
s = s & TypeName(ctlCur) & " Width: " & Int(ScaleX(.Width, vbTwips, vbPixels)) & sCrLf
s = s & TypeName(ctlCur) & " Height: " & Int(ScaleY(.Height, vbTwips, vbPixels)) & sCrLf
lblData.Caption = s
End With
End Sub
Private Sub chkSmall_Click()
If chkSmall.Value = vbChecked Then
lstvwVB.View = lvwSmallIcon
lstvwFixed.View = lvwSmallIcon
Else
lstvwVB.View = lvwIcon
lstvwFixed.View = lvwIcon
End If
End Sub
Private Sub img_Click(Index As Integer)
Set ctlLast = ctlCur
Set ctlCur = img(Index)
PictureData
End Sub
Private Sub pb_Click(Index As Integer)
Set ctlLast = ctlCur
Set ctlCur = pb(Index)
PictureData
End Sub